import itertools


def get_combinations(arr, page_size):
    combinations = list(itertools.permutations(arr, page_size))
    print("-----------", len(combinations))
    return combinations


def get_page(combinations, page_number):
    # page_size = len(combinations)
    if page_number*page_size > len(combinations):
        return []
    start = (page_number - 1) * page_size
    end = start + page_size
    print(start, "---", end)
    return combinations[start:end]


# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] # 创建一个包含33个元素的数组
arr = [i for i in range(1, 34)]
page_size = 5
page_number = 2
print("-----------")
combinations = get_combinations(arr, page_size)
page = get_page(combinations, page_number)

print(page)
